package com.spring.takeaway.serviceimpl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.spring.takeaway.dao.MerchantDao;
import com.spring.takeaway.po.MerChant;
import com.spring.takeaway.service.MerChantService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @Author LCD
 * @Date 2022/6/11 14:32
 **/
@Service
public class MerchantServiceImpl implements MerChantService {

    @Autowired
    private MerchantDao merchantDao;

    @Override
    public List<MerChant> findListMerChant(Integer k) {
        QueryWrapper wrapper = new QueryWrapper();
        if (k==0)
            wrapper.eq("mer_categoryname","面条米粉");
        if (k==1)
            wrapper.eq("mer_categoryname","烧烤龙虾");
        if (k==2)
            wrapper.eq("mer_categoryname","甜点饮品");
        if (k==3)
            wrapper.eq("mer_categoryname","甜蜜蛋糕");
        if (k==4)
            wrapper.eq("mer_categoryname","生鲜果蔬");
        if (k==5)
            wrapper.eq("mer_categoryname","超市便利");
        return this.merchantDao.selectList(wrapper);
    }

    @Override
    public List<MerChant> SearchMerchant(String keyword) {
       QueryWrapper wrapper = new QueryWrapper();
       wrapper.like(keyword!=null,"mer_name",keyword);
       return this.merchantDao.selectList(wrapper);
    }
}
